<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id()->comment('主键id');
            $table->string('username', 100)->unique()->comment('账号');
            $table->string('password', 200)->nullable()->comment('密码');
            $table->string('nickname', 100)->comment('昵称');
            $table->string('avatar', 255)->nullable()->comment('头像');
            $table->string('mobile', 100)->nullable()->comment('手机号');
            $table->tinyInteger('status')->default(1)->comment('状态：0-禁用，1-启用!!');
            $table->integer('deptId')->nullable()->comment('部门id');
            $table->string('email', 100)->nullable()->comment('邮箱');
            $table->char('gender', 1)->nullable()->comment('性别');
            $table->json('roleIds')->comment('角色id');
            $table->timestamp('createTime')->nullable()->comment('创建时间（秒级时间戳）');
            $table->timestamp('updateTime')->nullable()->comment('更新时间（秒级时间戳）');
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('users');
    }
};
